<?php

declare(strict_types=1);

namespace DreamCat\StateMachine;

use DreamCat\StateMachine\Error\TransferExceiption;
use DreamCat\StateMachine\Popo\MachineData;
use DreamCat\StateMachine\Popo\StateHealthResult;

/**
 * 状态机转移操作接口
 * @author vijay
 */
interface StateMachineTransferInterface
{
    /**
     * 尝试转移到目标状态
     * @param MachineData $machineData 状态机当前数据
     * @param string $targetState 目标状态
     * @return void
     * @throws TransferExceiption 状态转移失败时抛出
     */
    public function tryGoto(MachineData $machineData, string $targetState): void;

    /**
     * 对当前状态机数据做健康检查
     * @param MachineData $machineData
     * @return StateHealthResult
     */
    public function health(MachineData $machineData): StateHealthResult;
}

# end of file
